﻿
-- ================================================
-- Remarks: 
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'Dasideen_User_GetUserProfileDetailsByUserKey')
	BEGIN
		DROP  Procedure  Dasideen_User_GetUserProfileDetailsByUserKey
	END

GO

CREATE PROCEDURE [Dasideen_User_GetUserProfileDetailsByUserKey]
-- =============================================
-- Author:		<Sagar s.k>
-- Create date: <02-03-2015>
-- Description:	<Dasideen_User_GetUserProfileDetailsByUserKey>
-- =============================================
-- Add the parameters for the stored procedure here
	(
				@UserKey INT
	)

AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT OFF;

	SELECT     [User].[UserKey],
	           [User].[UserLoginID],
	           [User].[UserFirstName],
			   [User].[UserLastName], 
			   [User].[UserPrimaryEmailID], 
			   [UserProfile].[UserFullName], 
			   [UserProfile].[UserSex], 
			   [UserProfile].[UserContactNumber],
			   [UserProfile].[UserAlternateEmailID],
			   [User].[Sys_DateOfCreation],
			   [UserProfileImage].[UserProfileImageData]
    FROM       [User] LEFT OUTER JOIN [UserProfile] 
	ON         [User].[UserKey] = [UserProfile].[UserKey] LEFT OUTER JOIN [UserProfileImage] 
	ON         [User].[UserKey] = [UserProfileImage].[UserKey]
	WHERE	   (
				   ([User].[UserKey] = @UserKey)
			   )
END
GO
